<template>
	<view class="container" @click="details(product.id)">
		<image :src="product.image" class="icon"></image>
		<view class="text">
			<view class="name ell">{{product.name}}</view>
			<view class="specifications ell" v-if="product.normal">{{product.normal}}</view>
			<view class="price"><text v-if="product.price"><text class="small">¥</text>{{product.price}}</text><text class="medium" v-if="product.score">+ {{product.score}}积分</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			product: {
			  type: Object,
			  value: {}
			}
		},
		data() {
			return {
			}
		},
		onLoad() {
		},
		methods: {
			details(id) {
				uni.navigateTo({
				    url: `/pages/product-details/index?productId=${id}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container{
		margin-bottom: 32rpx;
		width: 329rpx;
		overflow: hidden;
		border-radius: 10rpx;
		background-color: #fff;
		.icon{
			width: 329rpx;
			height: 329rpx;
		}
		.text{
			padding: 22rpx 20rpx 29rpx;
			.name{
				line-height: 38rpx;
				font-size: 28rpx;
				font-weight: bold;
				color: #080808;
			}
			.specifications{
				margin-top: 2rpx;
				line-height: 32rpx;
				font-size: 22rpx;
				color: #818181;
			}
			.price{
				margin-top: 20rpx;
				line-height: 40rpx;
				font-size: 40rpx;
				color: #ED602B;
				.small{
					font-size: 24rpx;
				}
				.medium{
					font-size: 28rpx;
				}
			}
		}
	}
</style>
